import java.util.Arrays;
import java.util.Random;

public class Main {
    public static void sortArray(int[] nums) {
        for(int i = 0; i < nums.length;i++) {
            boolean flag = true;
            for (int j = 0; j < nums.length-1-i;j++) {
                if (nums[j] > nums[j+1]) {
                    int tmp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = tmp;
                    flag = false;
                }
            }
            if(flag) {
                return ;
            }
        }
    }
    public static void main(String[] args) {
        int[] array = {5, 2, 3, 1, 9, 10, 20, 15};
/*        QuickSort quickSort = new QuickSort();
        quickSort.myQuickSort(array,0,array.length-1);
        System.out.println(Arrays.toString(array));*/
        sortArray(array);
        System.out.println(Arrays.toString(array));
    }
    /*public static void main(String[] args) {
        int[] array = new int[10_0000];
*//*        for (int i = 0; i < args.length; i++) {
            array[i] = i;
        }*//*
        Random random = new Random();
        int num = random.nextInt();
        testInertSort(array);
    }
    public static void testInertSort(int[] array){
        array = Arrays.copyOf(array,array.length);
        long statTime = System.currentTimeMillis();
        InsertSort.myInsertSort(array);
        long engTime = System.currentTimeMillis();
        System.out.println("插入排序的效率:"+(engTime-statTime));
    }
    public static void main1(String[] args) {
        int[] array = {5,2,3,1,9,10,20,15};

        //选择排序
        SelectSort selectSort = new SelectSort();
        selectSort.mySelectSort(array);
        System.out.println(Arrays.toString(array));*/
        //冒泡排序
/*        BubbleSort bubbleSort = new BubbleSort();
        bubbleSort.myBubbleSort(array);
        System.out.println(Arrays.toString(array));*/
        //插入排序
/*        InsertSort insertSort = new InsertSort();
        insertSort.myInsertSort(array);
        System.out.println(Arrays.toString(array));
    }*/
}
